<template>
  <div class="wrapper">
    <swiper :options="swiperOption">
      <swiper-slide v-for="(val, key,index) in swiperList" :key="index">
        <img class="swiper-img" :src="'//' + val">
      </swiper-slide>
      <div class="swiper-pagination"  slot="pagination"></div>
    </swiper>
  </div>
</template>

<script>
import axios from 'axios'

export default {
  name: 'MallSwiper',
  data () {
    return {
      swiperOption: {
        pagination: '.swiper-pagination',
        loop: true,
        // 自动播放
        autoplay: 3000,
        autoplayDisableOnInteraction: false
      },
      swiperList: []
    }
  },
  mounted () {
    axios({
      method: 'get',
      url: '/brand/carousel'
    }).then((res) => {
      this.swiperList = res.data.data
      console.log(this.swiperList, 'res.data swiper')
    })
  }
}
</script>

<style lang="scss" scoped>
  .wrapper{
    overflow: hidden;
    width: 100%;
    height: 0;
    padding-bottom: 31.25%;
    .swiper-img{
      width: 100%;
    }
  }

</style>
